<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            var subsets = function (nums) {
                let res = []
                function backTracking(path, start) {
                    //剪枝条件
                    if (start > nums.length) return
                    //子集类问题无推入条件，因为它要的是每一个节点
                    res.push([...path])
                    for (let i = start; i < nums.length; i++) {
                        path.push(nums[i])
                        backTracking(path, i + 1)
                        path.pop()
                    }
                }
                backTracking([], 0)
                return res
            }
        </script>
    </body>
</html>
